/**
 * Copyright © 2013 Creativor Studio.
 * About license information, please see LICENSE.txt.
 */
package org.creativor.rayson.util;

/**
 * Utility for JAVA language.
 * 
 * @author creativor
 */
public final class LangUtil {

	/**
	 * Test whether an argument object is a null one. If it is, an
	 * {@link IllegalArgumentException} will be thrown.
	 * 
	 * @param obj
	 *            Argument object to be test.
	 * @throws IllegalArgumentException
	 *             If the object is null.
	 */
	public static void testNullArgument(final Object obj)
			throws IllegalArgumentException {
		if (obj == null)
			throw new IllegalArgumentException("argument should not be null");
	}

	/**
	 * Test whether an argument object is a null one. If it is, an
	 * {@link IllegalArgumentException} will be thrown.
	 * 
	 * @param obj
	 *            Argument object to be test.
	 * @param name
	 *            Argument name.
	 * @throws IllegalArgumentException
	 *             If the object is null.
	 */
	public static void testNullArgument(final Object obj, final String name)
			throws IllegalArgumentException {
		if (obj == null)
			throw new IllegalArgumentException("argument " + name
					+ " should not be null");
	}

	private LangUtil() {
		// Forbidden.
	}
}
